package com.shenmazong.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2022/1/19 11:46
 */

@Configuration
public class RabbitMqConfig {
    @Bean
    public Queue shopperQueue() {
        return new Queue("shopper");
    }

    @Bean
    public Queue htmlQueue() {
        return new Queue("html");
    }

    @Bean
    public TopicExchange shopExchange() {
        return new TopicExchange("shopExchange");
    }

    @Bean
    public Binding shopperQueueBind() {
        return BindingBuilder.bind(shopperQueue()).to(shopExchange()).with("shopper.*");
    }

    @Bean
    public Binding htmlQueueBind() {
        return BindingBuilder.bind(htmlQueue()).to(shopExchange()).with("html.*");
    }
}
